Skip to content

Improved ChatGpt requests and response handling #1262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 27, 2025

Conversation

Zabuzard
Copy link
Member

@Zabuzard Zabuzard commented Jun 27, 2025

Summary

This tweaks the requests send to ChatGpt. In many cases the final text was a bit bullshit or weird (for example containing empty strings, text that just stopped or sentences put together without a full stop separating them).

This significantly improves the quality of the ChatGpt responses in many edge cases - in particular for the newly added feature where ChatGpt also adds useful links to questions.

Other

Further:

  • "useful links" have been reduced from 5 to 3.
  • added hint for chatgpt to use markdown syntax
  • added proper chatgpt request/response logging (debug level)
  • question length checking was weird and not robust, simplified the code
  • improved the "context" handling and code clarity, especially for the two other features using chatgpt (/transfer title, /chatgpt)
  • renamed some variable names for clarity
  • reduced the part in chatgpt code that is wrapped by try-catch to the part that actually throws

Tests

Tested locally. Some impressions:

Before

before

After

after1

after2

@Zabuzard Zabuzard self-assigned this Jun 27, 2025
@Zabuzard Zabuzard requested a review from a team as a code owner June 27, 2025 10:45
@Zabuzard Zabuzard added the enhancement New feature or request label Jun 27, 2025
Copy link

@Zabuzard Zabuzard merged commit 4f03aa8 into develop Jun 27, 2025
11 checks passed
@Zabuzard Zabuzard deleted the feature/improve_chatgpt branch June 27, 2025 14:12
christolis pushed a commit to christolis/TJ-Bot that referenced this pull request Jun 28, 2025
* improved chatgpt requests and response handling

* markdown hint

* (removed extra space)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants